<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<html:form action="/Asamblea.do" >
    <input type="hidden" name="method" value="guardarAsistencia"/>
    <TABLE style="WIDTH: 100%">
        <TBODY>
            <TR>
                <TD class=espacio_titulo_barra></TD></TR>
            <TR>
                <TD>
                    <DIV>   <!-- ACA EMPEZAR FORMULARIOS DE ORGANIZACION DE MIEMBROS -->
                        <TABLE width="100%">
                            <TBODY>
                                <TR>
                                    <TD style="HEIGHT: 40px"><SPAN
                                            id=ctl00_cphCuerpo_lbltitulo class=titulo>Lista de Asistentes </SPAN>
                                        <HR>
                                    </TD></TR>
                                <TR>
                                    <TD></TD></TR>
                                <TR>
                                    <TD style="HEIGHT: 30px" vAlign=bottom>
                                        <c:if test="${AsambleaForm.readOnly == 'M'}">
                                            <INPUT id=ctl00_cphCuerpo_btnNuevo value="Grabar Asistencia" type=button name=ctl00$cphCuerpo$btnNuevo ${fn:length(AsambleaForm.beanDetailList)==0?'disabled':''} onClick="guardar()">
                                            <%--<html:submit styleId="ctl00_cphCuerpo_btnNuevo" value="Grabar Asistencia" disabled="${fn:length(AsambleaForm.beanDetailList)==0?'true':'false'}"/>--%>
                                        </c:if>
                                        <c:if test="${AsambleaForm.readOnly == 'N'}">
                                            <INPUT id=ctl00_cphCuerpo_btnNuevo value="Agregar" type=button name=ctl00$cphCuerpo$btnNuevo onClick="window.location = '<html:rewrite action="/Asamblea.do?method=registrarListaAsistentes"/>'">
                                        </c:if>
                                        <INPUT id=ctl00$cphCuerpo$btnNuevo value="Atr&aacute;s" type=button name=ctl00$cphCuerpo$btnNuevo2 onClick="window.location = '<html:rewrite action="/Asamblea.do?method=cargar&selectedIndex=${AsambleaForm.bean.codigo}"/>'">                      </TD>
                                </TR>
                                <TR>
                                    <TD>
                                        <TABLE border=0 width="100%">
                                            <TBODY>
                                                <TR>
                                                    <TD width="10%" style="HEIGHT: 30px"><SPAN
                                                            id=ctl00_cphCuerpo_lblNombre>Asamblea</SPAN></TD>
                                                    <TD width="75%">
                                                        <bean:write name="AsambleaForm" property="bean.nombre"/>
                                                    </TD>
                                                    <TD width="4%">&nbsp;</TD>
                                                    <TD width="4%">&nbsp;</TD>
                                                    <TD width="4%">&nbsp;</TD>
                                                    <TD width="4%">&nbsp;</TD></TR>
                                                <TR>
                                                    <TD style="HEIGHT: 15px" vAlign=bottom
                                                        colSpan=6></TD></TR>
                                                <TR>
                                                    <TD style="HEIGHT: 15px" vAlign=bottom
                                                        colSpan=6><strong>Lista de asistentes </strong></TD>
                                                </TR>
                                                <TR>
                                                    <TD colSpan=6>
                                                        <DIV>              
                                                            <logic:notEmpty name="AsambleaForm" property="beanDetailList">
                                                                <c:choose>
                                                                    <c:when test="${AsambleaForm.readOnly == 'N'}">
                                                                        <TABLE
                                                                            style="WIDTH: 100%; BORDER-COLLAPSE: collapse; HEIGHT: 37px"
                                                                            id=ctl00_cphCuerpo_gvCandidatos
                                                                            class="DivGrillaBorde GridViewStyle" border=1
                                                                            rules=all cellSpacing=0>
                                                                            <TBODY>
                                                                                <TR>
                                                                                    <TH class=header-gridview scope=col>Convocado</TH>
                                                                                    <TH class=header-gridview
                                                                                        scope=col>Eliminar</TH>
                                                                                </TR>
                                                                                <logic:iterate id="asistente" name="AsambleaForm" property="beanDetailList" indexId="index">
                                                                                    <TR ${index%2==0?'':'class=GridViewAlternatingRowStyle'}>
                                                                                        <TD>${asistente.socio.nombre} </TD>
                                                                                        <TD><div align="center">
                                                                                                <img src="../img/ic-papelera.gif" alt="1" onClick="if (confirm('&iquest;Esta seguro de Eliminar?'))window.location = '<html:rewrite action="/Asamblea.do?method=eliminarListaAsistentes&selectedIndex2=${asistente.codigo}"/>'" >

                                                                                            </div></TD>
                                                                                    </TR>
                                                                                </logic:iterate>
                                                                            </TBODY></TABLE>

                                                                    </c:when>
                                                                    <c:otherwise>
                                                                        <TABLE
                                                                            style="WIDTH: 100%; BORDER-COLLAPSE: collapse; HEIGHT: 37px"
                                                                            id=ctl00_cphCuerpo_gvCandidatos
                                                                            class="DivGrillaBorde GridViewStyle" border=1
                                                                            rules=all cellSpacing=0>
                                                                            <TBODY>
                                                                                <TR>
                                                                                    <TH class=header-gridview scope=col>Asistencia</TH>
                                                                                    <TH class=header-gridview scope=col>Convocado</TH>
                                                                                </TR>
                                                                                <logic:iterate id="asistente" name="AsambleaForm" property="beanDetailList" indexId="index">
                                                                                    <TR ${index%2==0?'':'class=GridViewAlternatingRowStyle'}>
                                                                                        <TD><label>
                                                                                                <div align="center">
                                                                                                    <input type="checkbox" name="asistente${asistente.codigo}" value="1" ${asistente.asisitio == 1?'checked':''}>
                                                                                                </div>
                                                                                            </label></TD>
                                                                                        <TD>${asistente.socio.nombre} </TD>
                                                                                    </TR>
                                                                                </logic:iterate>
                                                                            </TBODY></TABLE>
                                                                        </c:otherwise>
                                                                    </c:choose>
                                                                </logic:notEmpty>

                                                        </DIV></TD></TR></TBODY></TABLE></TD></TR>
                                <TR>
                                    <TD style="HEIGHT: 30px" vAlign=bottom>
                                        <c:if test="${AsambleaForm.readOnly == 'M'}">
                                            <INPUT id=ctl00_cphCuerpo_btnNuevo value="Grabar Asistencia" type=button name=ctl00$cphCuerpo$btnNuevo ${fn:length(AsambleaForm.beanDetailList)==0?'disabled':''} onClick="guardar()">
                                            <%--<html:submit styleId="ctl00_cphCuerpo_btnNuevo" value="Grabar Asistencia" disabled="${fn:length(AsambleaForm.beanDetailList)==0?'true':'false'}"/>--%>
                                        </c:if>
                                        <c:if test="${AsambleaForm.readOnly == 'N'}">
                                            <INPUT id=ctl00_cphCuerpo_btnNuevo value="Agregar" type=button name=ctl00$cphCuerpo$btnNuevo onClick="window.location = '<html:rewrite action="/Asamblea.do?method=registrarListaAsistentes"/>'">
                                        </c:if>
                                        <INPUT id=ctl00$cphCuerpo$btnNuevo value="Atr&aacute;s" type=button name=ctl00$cphCuerpo$btnNuevo2 onClick="window.location = '<html:rewrite action="/Asamblea.do?method=cargar&selectedIndex=${AsambleaForm.bean.codigo}"/>'">                      </TD>
                                </TR></TBODY></TABLE></DIV>

                    <!-- ACA TERMINARA FORMULARIOS DE ORGANIZACION DE MIEMBROS -->

                </TD></TR></TBODY></TABLE>
            </html:form>


<script language="JavaScript">

    function guardar(){
        if(confirm('Desea guardar la asistencia?')){
            document.getElementsByName('method')[0].value="guardarAsistencia";
            document.AsambleaForm.submit();
        }
    }

</script>